package zjh_20230314;

import java.util.HashMap;
import java.util.Map;

public class Demo01 {
    public static void main(String[] args) {
        Map<Integer,String> map = new HashMap<Integer,String>();
        map.put(1,"张三丰");
        map.put(2,"周芷若");
        map.put(3,"汪峰");
        map.put(4,"灭绝师太");
        bianli(map);

        map.put(5,"郭靖");
        bianli(map);

        map.remove(1);
        bianli(map);

        map.replace(2,"周林");
        bianli(map);

    }
    public static void bianli(Map map){
        for (Object key :
                map.keySet()) {
            System.out.println("序号："+ key +"  姓名：" + map.get(key));
        }
    }
}
